package com.zhou.common.mybatis.template.shiro.util;

import com.digital.cnzz.flow.platform.api.FlowClientService;
import com.digital.cnzz.flow.platform.api.request.*;
import com.digital.cnzz.flow.platform.api.response.*;
import com.digital.cnzz.flow.platform.manager.common.ResponseResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @author lilh
 * @date 2020/10/29 17:11
 */
//@RestController
//@RequestMapping("/" + API_PUBLIC_PATH)
@FeignClient(value = "flow-platform", url = "${flow.service-url}", configuration = FlowClientFeignConfiguration.class)
public interface FlowClientHttpService extends FlowClientService {

    @Override
    @PostMapping("/applyProcess")
    @ApiOperation(value = "发起申请")
    ResponseResult<HttpCommandResultDto> applyProcess(@RequestBody HttpApplyProcessDto applyProcessDto);

    @Override
    @GetMapping("/getStartForm")
    @ApiOperation(value = "获取启动表单schema")
    ResponseResult<FormCreateResultDto> getStartForm(@RequestParam String modelKey);

    @Override
    @GetMapping("/getStartFormWithData")
    @ApiOperation(value = "获取启动表单schema + 表单数据")
    ResponseResult<ProcessInstanceFormDetailResultDto> getStartFormWithData(@RequestParam String processInstanceId);

    @Override
    @GetMapping("/getTaskForm")
    @ApiOperation(value = "获取任务关联的表单schema")
    ResponseResult<TaskFormDetailResultDto> getTaskForm(@RequestParam String taskId);

    @Override
    @GetMapping("/getTaskFormWithData")
    @ApiOperation(value = "获取任务关联的表单schema + 表单数据")
    ResponseResult<TaskFormDetailResultDto> getTaskFormWithData(@RequestParam String taskId);

    @Override
    @PostMapping("/task/form/general")
    @ApiOperation(value = "获取任务关联的表单 + 任务变量")
    ResponseResult<TaskGeneralFormResultDTO> getTaskGeneralFormWithVars(@RequestBody HttpTaskGeneralFormQueryDTO query);

    @Override
    @PostMapping("/createProcessInstance")
    @ApiOperation(value = "创建流程实例")
    ResponseResult<HttpCommandResultDto> createProcessInstance(@RequestBody HttpCreateProcessInstanceDto createProcessInstanceDto);

    @Override
    @PostMapping("/startProcessInstance")
    @ApiOperation("启动流程实例")
    ResponseResult<HttpCommandResultDto> startProcessInstance(@RequestBody HttpStartProcessInstanceDto startProcessInstanceDto);

    @Override
    @PostMapping("/completeWorkItem")
    @ApiOperation("完成工作项(办理任务)")
    ResponseResult<HttpCommandResultDto> completeWorkItem(@RequestBody HttpCompleteWorkItemDto completeWorkItemDto);

    @Override
    @PostMapping("/terminateProcessInstance")
    @ApiOperation("终止流程")
    ResponseResult<HttpCommandResultDto> terminateProcessInstance(@RequestBody HttpTerminateProcessInstanceDto httpTerminateProcessInstanceDto);

    @Override
    @PostMapping("/dispatchWorkItem")
    @ApiOperation("转办工单")
    ResponseResult dispatchWorkItem(@RequestBody HttpDispatchWorkItemDto dispatchWorkItemDto);

    @Override
    @PostMapping("/listTask")
    @ApiOperation("待办/经办任务列表")
    ResponseResult<HttpCommandPageResultDto<List<HttpTaskQueryInfoDto>>> listTask(@RequestBody HttpTaskListQueryDto taskListQueryDto);

    @Override
    @PostMapping("/myApply")
    @ApiOperation("我的申请")
    ResponseResult<HttpCommandResultDto> listMyApply(@RequestBody HttpMyApplyQueryDto myApplyQueryDto);


    @Override
    @GetMapping("/getFlowRecords")
    @ApiOperation(value = "获取流程流转记录")
    ResponseResult<List<FlowRecordResultDto>> getFlowRecords(@RequestParam String processInstanceId);

    @Override
    @PostMapping("/jumpTask")
    @ApiOperation(value = "跳转任务节点")
    ResponseResult<HttpCommandResultDto> jumpTask(@RequestBody HttpTaskJumpCommandDto httpTaskJumpCommandDto);

    @Override
    @GetMapping("/getProcessHistoryVars")
    ResponseResult<Map<String, Object>> getProcessHistoryVariables(@RequestParam String processInstanceId);

    @Override
    @PostMapping("/model/running/list")
    ResponseResult<List<FlowModelInfoDto>> getRunningModelList(@RequestBody HttpRunningModelQueryDto query);

    @Override
    @GetMapping("/task/participant/vars")
    ResponseResult<List<UserTaskNodeDTO>> getFlowUserTaskNodeList(@RequestParam String processDefKey);

    @Override
    @PostMapping("/process/instance/operate")
    ResponseResult operateProcessInstance(@RequestBody HttpProcessInstanceOperationDTO operation);
}
